package com.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelp extends SQLiteOpenHelper {
    private final String TABLENAME="a";
    private static final String DATABASE_NAME = "my_work_database.db";
    // 数据库版本
    private static final int DATABASE_VERSION = 1;

    public DBHelp(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        String createTableSQL="create table "+TABLENAME+
                "(id integer primary key autoincrement,"+//id
                "name text,"+//用户名
                "phone text," +
                "phone_2 text"+//两个电话号码，分别是是电话1和电话2
                ")";
        db.execSQL(createTableSQL);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int i, int i1) {
        db.execSQL("DROP TABLE IF EXISTS "+TABLENAME);
        onCreate(db);
    }
}
